import request from '@/utils/request'

export function fetchHomeResourceList(depotId) {
  return request({
    url:'/resources/list',//+depotId,//这个应该有个depotId啊？？？？
    method:'get',
    params:{depotId:depotId}
  })
}

//获取资源详情
export function fetchResourceDetail(rid){
  return request({
    url:'/resources/detail/'+rid,
    method:'get',
    // params:{rid:rid}
  })
}

export function updateHomeResource(data) {
  return request({
    url:'/resources/upsert',
    method:'post',
    data:data
  })
}
export function deleteHomeResource(id) {
    return request({
      url:'/resources/del/'+id,//{rid}
      method:'get',
    })
}
//获取某resource下关联的商品列表
export function fetchRelatedProductList(rid) {
    return request({
      url:'/resources/relation/list/'+rid,
      method:'get',
      // params:{rid:rid}
    })
}
//某resource新增关联商品
export function updateResourceProduct(data) {
    return request({
    url:'/resources/relation/upsert',
    method:'post',
    data:data
    })
}
//删除某resource的某个关联商品
export function delRelatedProductList(rpid) {
    return request({
      url:'/resources/relation/clear/'+rpid,
      method:'get',
    })
}